package com.school.test.search.plugin.mongo;

import com.jfinal.plugin.IPlugin;
import com.mongodb.MongoClient;

/**
 * @author 马洁
 * @date 2019/12/21 - 17:16
 */
public class MongoDbPlugin implements IPlugin {
    public MongoDbPlugin(String host, int port, String database) {
        MongoDb.setMongoDatabase(new MongoClient(host, port).getDatabase(database));
    }

    public MongoDbPlugin(String database) {
        this("localhost", 27017, database);
    }

    @Override
    public boolean start() {
        return true;
    }

    @Override
    public boolean stop() {
        return true;
    }
}
